/**
 * 
 *//*
package com.risetek.tft.context;

import java.io.Serializable;

import org.hibernate.EntityMode;
import org.hibernate.HibernateException;
import org.hibernate.event.spi.PostDeleteEvent;
import org.hibernate.event.spi.PostDeleteEventListener;
import org.hibernate.event.spi.PostInsertEvent;
import org.hibernate.event.spi.PostInsertEventListener;
import org.hibernate.event.spi.PostUpdateEvent;
import org.hibernate.event.spi.PostUpdateEventListener;
import org.hibernate.persister.entity.EntityPersister;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

*//**
 * hibernate监听器
 * @author hetao 
 * 
 *//*
public class HistoryListener implements PostInsertEventListener,
		PostUpdateEventListener, PostDeleteEventListener {

	public interface HistoryExecutor {
		void onDelete(PostDeleteEvent event);
		void onUpdate(PostUpdateEvent event);
		void onInsert(PostInsertEvent event);
	}
	
	private Logger logger = LoggerFactory.getLogger(HistoryListener.class);
	
	private HistoryExecutor executor = new HistoryExecutor() {
		public void onDelete(PostDeleteEvent event) {
			Object entity = event.getEntity();
			Serializable pk = event.getSession().getSessionFactory()
					.getClassMetadata(entity.getClass()).getIdentifier(entity);
			try {
				logger.info("[删除]" + entity.getClass().getName() + ":" + pk);
			} catch (HibernateException e) {
				e.printStackTrace();
			}
		}
		
		public void onInsert(PostInsertEvent event) {
			Object entity = event.getEntity();
			Serializable pk = event.getSession().getSessionFactory()
					.getClassMetadata(entity.getClass())
					.getIdentifier(entity);
			try {
				logger.info("[新增]" + entity.getClass().getName() + ":" + pk);
			} catch (HibernateException e) {
				e.printStackTrace();
			}
		}
		
		public void onUpdate(PostUpdateEvent event) {
			Object entity = event.getEntity();
			Serializable pk = event.getSession().getSessionFactory()
					.getClassMetadata(entity.getClass())
					.getIdentifier(entity);
			try {
				logger.info("[更新]" + entity.getClass().getName() + ":" + pk);
			} catch (HibernateException e) {
				e.printStackTrace();
			}
		}
		
	};
	
	public void onPostDelete(PostDeleteEvent event) {
		executor.onDelete(event);
	}

	public void onPostUpdate(PostUpdateEvent event) {
		executor.onUpdate(event);
	}

	public void onPostInsert(PostInsertEvent event) {
		executor.onInsert(event);
	}

	public HistoryExecutor getExecutor() {
		return executor;
	}

	public void setExecutor(HistoryExecutor executor) {
		this.executor = executor;
	}

	@Override
	public boolean requiresPostCommitHanding(EntityPersister arg0) {
		// TODO Auto-generated method stub
		return false;
	}
	
}
*/